//
//  THBabySeriviceTableViewCell.m
//  TreeHole
//
//  Created by apple on 2020/9/21.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "THBabyOrderTableViewCell.h"

@interface THBabyOrderTableViewCell()
@property(nonatomic, strong) UIImageView                     *iconImageView;/**<  */

@property(nonatomic, strong) STLabel                     *saleLable;/**<  */

@property(nonatomic, strong) STLabel                     *priceLable;/**<  */

@property(nonatomic, strong) STButton                     *codeButton;/**<  */
@end
@implementation THBabyOrderTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self stoneobs_ui_configSubView];
    }
    return self;
}
+ (CGFloat)stoneobs_ui_cell_height{
    return 100 + 12 + 44;
}
#pragma mark --configSubView
- (void)stoneobs_ui_configSubView{
    UIImageView * stoneobs_ui_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 100, 100)];
    stoneobs_ui_imageView.image = [UIImage imageNamed:@"ic_none"];
    [self.contentView addSubview:stoneobs_ui_imageView];
    self.iconImageView = stoneobs_ui_imageView;
    stoneobs_ui_imageView.layer.cornerRadius = 4;
    stoneobs_ui_imageView.clipsToBounds = YES;
    CGFloat left = stoneobs_ui_imageView.right + 10;
    
    __weak typeof(self) weakSelf =  self;
    STButton * code_button = [[STButton alloc] initWithFrame:CGRectMake(stoneobs_ui_imageView.right + 15, 0, 40, 40)
                                                              title:nil
                                                         titleColor:nil
                                                          titleFont:0
                                                       cornerRadius:0
                                                    backgroundColor:FlatGray
                                                    backgroundImage:nil
                                                              image:nil];
    self.codeButton = code_button;
    [code_button setClicAction:^(UIButton *sender) {
        STTools_WebViewController * vc = [STTools_WebViewController.alloc initWithUrl:weakSelf.model.code_url];
        vc.forceTitle = @"二维码";
        [TMUtils.stoneobs_fun_get_currentTopController pushViewController:vc animated:1];
    }];
    [self.contentView addSubview:code_button];
    code_button.bottom = self.iconImageView.bottom;
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, stoneobs_ui_imageView.top, 200, 20)
                                                                text:@"sasd"
                                                           textColor:STONEOBS_UI_FIRST_TEXT_COLOR
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.nameLable = stoneobs_ui_label;
    });
    
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, stoneobs_ui_imageView.top, 200, 20)
                                                                text:@"sasd"
                                                           textColor:FlatOrange
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentRight];
        [self.contentView addSubview:stoneobs_ui_label];
        self.statusLable = stoneobs_ui_label;
        stoneobs_ui_label.right = UISCREEN_WIDTH - 15;
    });
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, stoneobs_ui_imageView.top, 200, 20)
                                                                text:@"sasd"
                                                           textColor:WH_UICOLOR_FROM_RGBA(0xFF6955)
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentRight];
        [self.contentView addSubview:stoneobs_ui_label];
        self.priceLable = stoneobs_ui_label;
        stoneobs_ui_label.bottom = self.iconImageView.bottom;
        stoneobs_ui_label.right = UISCREEN_WIDTH - 15;
    });
    
    
    ({
        STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(left, self.nameLable.bottom + 5, 200, 20)
                                                                text:@"预售"
                                                           textColor:STONEOBS_UI_SECEND_TEXT_COLOR
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [self.contentView addSubview:stoneobs_ui_label];
        self.saleLable = stoneobs_ui_label;
    });
    
    
    UIView * stoneobs_ui_line = [[UIView alloc] initWithFrame:CGRectMake(15, self.class.stoneobs_ui_cell_height - 1, UISCREEN_WIDTH - 30, 0.5)];
    stoneobs_ui_line.backgroundColor = STONEOBS_UI_LINE_COLOR;
    [self.contentView addSubview:stoneobs_ui_line];
    
    
    ({
        STButton * stoneobs_ui_button = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 67, 24)
                                                                  title:@"去付款"
                                                             titleColor:UIColor.whiteColor
                                                              titleFont:12
                                                           cornerRadius:12
                                                        backgroundColor:nil
                                                        backgroundImage:nil
                                                                  image:nil];
        [stoneobs_ui_button setClicAction:^(UIButton *sender) {

        }];
        stoneobs_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        stoneobs_ui_button.bottom = stoneobs_ui_line.bottom - 12;
        stoneobs_ui_button.right = UISCREEN_WIDTH - 15;
        stoneobs_ui_button.hidden = YES;
        [TMUtils stoneobs_fun_makeViewToThemeGrdualColor:stoneobs_ui_button];
        [self.contentView addSubview:stoneobs_ui_button];
        self.payButton = stoneobs_ui_button;
    });


    
    ({
        STButton * stoneobs_ui_button = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 67, 24)
                                                                  title:@"去评价"
                                                             titleColor:UIColor.whiteColor
                                                              titleFont:12
                                                           cornerRadius:12
                                                        backgroundColor:nil
                                                        backgroundImage:nil
                                                                  image:nil];
        [stoneobs_ui_button setClicAction:^(UIButton *sender) {

        }];
        stoneobs_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        stoneobs_ui_button.bottom = stoneobs_ui_line.bottom - 12;
        stoneobs_ui_button.right = self.payButton.left -  15;
        stoneobs_ui_button.hidden = YES;
        [TMUtils stoneobs_fun_makeViewToThemeGrdualColor:stoneobs_ui_button];
        [self.contentView addSubview:stoneobs_ui_button];
        self.evaButton = stoneobs_ui_button;
    });
    
    
}
- (void)setModel:(THBabyOrderModel *)model{
    _model = model;
    [self.iconImageView sd_setImageWithURL:model.header_img.mj_url];
    self.nameLable.text = [NSString stringWithFormat:@"服务项目:%@",model.major];;
    self.priceLable.text = [NSString stringWithFormat:@"￥%@",model.price];
    self.saleLable.text = [NSString stringWithFormat:@"客户姓名:%@",model.name];
    
    [self.codeButton sd_setImageWithURL:model.code_url.mj_url forState:UIControlStateNormal];
}
@end
